home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / STRCAT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  541 b   |  24 lines

  1. /* strcat.c From page 274 of TC Bible  Use strcat to concatenate
  2. (append) one string to another. */
  3.  
  4.  
  5. #include <stdio.h>
  6. #include <string.h>
  7. main()
  8. {
  9.     char fullname[80], last[40], middle[10];
  10.     printf("Enter your first name: ");
  11.     gets(fullname);
  12.     printf("Last name: ");
  13.     gets(last);
  14.     printf("Middle initial: ");
  15.     gets(middle);
  16.  
  17.     /* Append the parts together to get full name */
  18.  
  19.     strcat(fullname, " ");
  20.     strcat(fullname, middle);
  21.     strcat(fullname, " ");
  22.     strcat(fullname, last);
  23.     printf("Greetings! %s\n", fullname);
  24. }